import java.util.Scanner;
import java.util.Stack;

public class Demo02 {
    public static void main(String[] args) {


        Scanner sc = new Scanner(System.in);
        int num;
        Stack<Integer> stack = new Stack<>();
        while((num = sc.nextInt()) != -1)
            stack.push(num);
        while(!stack.isEmpty())
            System.out.print(stack.pop() + "   ");
        }
    }

